<template>
	<view>
		<view class="u-p-20">
			<view class="bg_FFFFFF u-b-r-16 u-p-20">
				<view v-for="(item,index) in list" :key="index" class="u-p-t-20 u-p-b-20" style="border-bottom: 1rpx solid #EAEAEA;">
					<view class=" u-flex">
						<u-image :src="item.avatar" mode="aspectFit" width="80rpx" height='80rpx'
							shape="circle">
						</u-image>
						<view class="u-h-100 u-m-l-24">
							<view class="u-flex u-w-580 u-row-between">
								<view class="u-flex">
									<view class="u-weight u-font-28">{{item.name}}</view>
									<view class="u-flex u-m-l-20"
										style="padding: 4rpx 10rpx;background-color:rgba(255,141,144,0.12);">
										<view class="u-h-40">
											<u-image src='https://www.sqkjkj.vip/wxImg/join/img2.png' width='23rpx' height='23rpx'>
											</u-image>
										</view>

										<view class="u-font-20 " style="color: #FF3846;">{{item.agent_title}}</view>
									</view>
								</view>
							</view>

							<view class=" u-font-20 u-flex u-row-between">
								<view class="">{{item.mobile}}</view>
								<view style="color: #898989;">{{item.create_time}}注册</view>
							</view>
						</view>

					</view>

					<view class="u-flex u-row-between u-m-t-26">
						<view class="u-flex u-font-20">
							<view class="" style="color: #454545;">区域人数:</view>
							<view class="" style="color: #FF3846;">{{item.area_num}}</view>
						</view>

						<view class="u-flex u-font-20">
							<view class="" style="color: #454545;">奖励金额:</view>
							<view class="" style="color: #FF3846;">{{item.bonus}}</view>
						</view>
					</view>
				
				
				</view>

			</view>
		</view>
		<!-- 加载更多 -->
		<u-loadmore :status="status" icon-type="circle" margin-bottom="20" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				params:{
					page:1,
					page_size:20
				},
				status: 'loadmore'
			}
		},
		onLoad(obj) {
			this.clear()
			this.agent_my_team_list()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			this.agent_my_team_list();
		},
		methods: {
			clear() {
				this.list = [];
				this.params.page = 1;
			},
			// 获取商品列表
			async agent_my_team_list() {
				await this.$api.agent_my_team_list(this.params, res => {
					if (res.data.code == 1) {
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.list = this.list.concat(res.data.data.data);
						uni.stopPullDownRefresh();
					}
				})
			},
		}
	}
</script>

<style scoped>
	page {
		background-color: #f5f5f5;
	}
</style>
